package com.supertimetable.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AutoCompleteTextView;
import android.widget.ImageView;

import com.supertimetable.activities.R;
import com.supertimetable.adapter.AutoTextViewAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Admin on 2018/1/12.
 */

public class StudentFragment extends Fragment {
    private ImageView verificationImage;

    private AutoCompleteTextView name = null;

    private List<String> arr = new ArrayList<>();

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_student, container, false);

        //验证码
        verificationImage = (ImageView) view.findViewById(R.id.verificationImage);
        verificationImage.setImageDrawable(getResources().getDrawable(R.drawable.verimg));

        name = (AutoCompleteTextView) view.findViewById(R.id.name);
        initViews();
        eventsViews();
        return view;
    }

    private void eventsViews() {
        AutoTextViewAdapter<String> adapter = new AutoTextViewAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,arr);

        name.setAdapter(adapter);
    }

    private void initViews() {
//        for (int i = 0 ; i <2 ; i++){
//            NameAndId nai1 = new NameAndId("zhangsanfeng","1001");
//            arr.add(nai1);
//            NameAndId nai2 = new NameAndId("王二麻","1002");
//            arr.add(nai2);
//            NameAndId nai3 = new NameAndId("张三","1004");
//            arr.add(nai3);
//            NameAndId nai4 = new NameAndId("张一山","1011");
//            arr.add(nai4);
//            NameAndId nai5 = new NameAndId("张三丰","1008");
//            arr.add(nai5);
//            NameAndId nai6 = new NameAndId("zhangfeng","1009");
//            arr.add(nai6);
//            NameAndId nai7 = new NameAndId("小王","1013");
//            arr.add(nai7);
//            NameAndId nai8 = new NameAndId("小丰","1018");
//            arr.add(nai8);
//            NameAndId nai9 = new NameAndId("wangzhang","1020");
//            arr.add(nai9);
//
//
//
//        }
    }

}
